#/bin/sh
#
# $Header: mkinitramfs-ll: /lib/mdev/dm_link             Exp $
# $Author: (c) 2011-2014 -tclover <tokiclover@gmail.com> Exp $
# $License: 2-clause/new/simplified BSD                  Exp $
# $Version: 0.14.4 2014/10/10 12:33:03                   Exp $
#

if [ "$ACTION" = "add" ]; then
	mkdir -m 755 -p /dev/mapper
	name="$(cat /sys/block/${MDEV}/dm/name)"
	[ -n "$name" ] && ln -f -s /dev/${MDEV} /dev/mapper/$name
fi

[ "$ACTION" = "remove" ] &&
for dm in /dev/mapper/*; do
	test -h $dm -a "$(readlink $dm)" = "/dev/$MDEV" && rm -f $dm && break
done

unset name

#
# vim:fenc=utf-8:ft=sh:ci:pi:sts=0:sw=4:ts=4:
#
